<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<jsp:useBean id="db" class="ctm.javacode.dbBean"/>
<%@page import ="java.sql.*" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>中醫體質評量系統</title>
<script language="Javascript" type="text/javascript">
function showSportlink(){
	sel = document.getElementById("sportlink");
	
	if(sel.className == "off"){
		sel.className = "on";
		if (role == "true"){
			document.getElementById("food").className = "on_food";
			document.getElementById("news").className = "off";
			document.getElementById("update").className = "off";
			document.getElementById("suitfood").className = "off";
		}else{
			document.getElementById("food").className = "off";
			document.getElementById("suitfood").className = "off";
		}
	}

}
function showFoodDemo(onclock){
	document.getElementById("news").className = "off";
	document.getElementById("update").className = "off";
	document.getElementById("food").className = "off";
	document.getElementById("suitfood").className = "off";
	
	var str = onclock;
	document.getElementById(str).className = "on_food";
}
</script>
<style type="text/css">
<!--
body {
	background-image: url(img/grass.jpg);
    background-position: center top;
	background-color: #FFFFFF;
	background-repeat: repeat;
}
body,td,th {
	color: #000000;
	font-size:24px;
	font-family: Arial;
}
.off { display:none }
.on  { text-align:center; isplay:inline}
.on_food  { display:block;}
a:link {
text-decoration:none;
font-family:Arial;
font-size:20px;
color:#FFFFFF;
}
a:visited {
text-decoration:none;
font-family:Arial;
font-size:20px;
color:#FFFFFF;
}
a:hover {
text-decoration:none;
font-family:Arial;
font-size:20px;
color:#000000;
}


.ind:link {
color: #535353;
text-decoration:none;
font-family:"標楷體";
font-size:18px;
}
.ind:visited {
color:#535353;
text-decoration:none;
font-family:"標楷體";
font-size:18px;
}

.ind:hover {
color:#BB280F;
text-decoration:none;
font-family:"標楷體";
font-size:18px;
}


.HEAD_STYLE {
	font-weight:bold;
	color: #1B4001;
	font-family:"標楷體";
	font-size:30px; 
}
.TEXT_STYLE {
	font-family:Arial;
	color:#193940;
	font-size:24px;
	font-weight:bold;
}
.BOTTOM_STYLE {
	color: #FFFFFF; 
	font-family: Arial; 
	font-size:20px;
}
.LEFT_BUTTON_G:link {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#FFFFFF;
	}
.LEFT_BUTTON_G:visited {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#FFFFFF;
	
}
.LEFT_BUTTON_G:hover {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#000000;
}


.LEFT_BUTTON_W:link {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#277C35;


}
.LEFT_BUTTON_W:visited {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#277C35;
}
.LEFT_BUTTON_W:hover {
	font-family:"標楷體"; 
	font-size:25px;
	text-decoration:none;
	color:#000000;
}
.button
{
	border:0px;
	background-color: #437A27;
	color: #FFFFFF;
	width:100%;
	font-size:20px;
	font-family:Arial;
	padding-top:0px;
	padding-bottom:0px;
}
.button:hover {
color: #000000;
}
.LEFT_BUTTON_top
{
border-left:solid;
border-left-color:#2C401E;
border-top:solid;
border-top-color:#2C401E;
border-right:solid;
border-right-color:#2C401E;

}
.LEFT_BUTTON_bottom
{
border-left:solid;
border-left-color:#2C401E;
border-bottom:solid;
border-bottom-color:#2C401E;
border-right:solid;
border-right-color:#2C401E;

}
.LEFT_BUTTON_middle
{
border-left:solid;
border-left-color:#2C401E;
border-right:solid;
border-right-color:#2C401E;

}
.LEFT_BUTTON_all
{
border:solid;
border-color:#2C401E;

}

.style1 {color: #FFFFFF}
.news_date{
	border-color:#437A27;
	border-style:double;
	
}
.news_context{
	border-color:#437A27;
	border-style:double;
	
	
}
-->
</style>

</head>
<body alink="#FF0000" vlink="#FF0000">
<%
	db.setDataSource("jdbc/ctmpllab");
	db.Connected();
	String name = (String)request.getSession().getAttribute("login");
	String username="";
	String sqlQuery = "select name from accounttable where ACCOUNT = '" + name + "'";
	ResultSet rs;
	rs = db.ExcuteQuery(sqlQuery);
	rs.next();
	username = rs.getString("name");	
	System.out.print(db.toString()+"\n");
%>
<table width="100%" border="0">
		<tr>
			<td><p>&nbsp;</p></td>
		</tr>	
 
    		<td width="5%">&nbsp;</td>
			
			<td bgcolor="#FFFFFF"><table width="100%" border="0">
      			<tr>
        			<td background="img/herbal.jpg">
						<p>&nbsp;</p>
          				<p>&nbsp;</p>
          				<p>&nbsp;</p>
          				<p>&nbsp;</p>
		  				<p>&nbsp;</p>
          
          			</td>
			  </tr>
     
	 
	 
	 
	  			  <tr>
        			<td>	
						<table bgcolor="#437A27" width="100%" border="0">
         					 <tr>
							 <form name="logoutform" action="logout.do" method="get">
            					<td width="38%"></td>
								<td width="27%"><div align="center" class="off" id="sportlink">
								  <% if (request.isUserInRole("user")) { %>
								  <a href="javascript:showFoodDemo('food')" target="_parent">禁忌食物</a>  
								  &nbsp;&nbsp;&nbsp;&nbsp;
								  <a href="javascript:showFoodDemo('suitfood')" target="_parent" >可用食物 </a>  
								  <br>
								  <%} %>
								  <% if (request.isUserInRole("admin")|| request.isUserInRole("professional")) { %>
								  	<a href="ProSuggest.jsp" target="_parent">飲食建議</a>	
								  <% } else { %>
								  	<a href="UserSuggest.jsp" target="_parent">飲食建議</a>	
								  <% } %>
								   	&nbsp;&nbsp;
								  <% if (request.isUserInRole("admin")|| request.isUserInRole("professional")) { %>								  
								  <a href="printsuggest.jsp" target="_new">飲食評量列印</a>
								  <br>
								  <% }else{%>
								  	&nbsp;&nbsp;
								  <% }%>
								  <a href="cuisine.jsp" target="_parent">參考食譜</a>
								  
								  <% if (request.isUserInRole("admin")|| request.isUserInRole("professional")) { %>
								  &nbsp;&nbsp;
								  <a href="maintenanceNourishment.jsp" target="_parent">營養品維護</a>
								  &nbsp;&nbsp;&nbsp;
								  <% }%>									  

							    </div></td>
								<td width="30%" align="right"><label style="color:#FFFFFF;"><%=username %></label></td>
								<td width="5%"  align="center">
									<input type="submit" value="登出" class="button">								
								</td>
       			 			   </form>
          			 		</tr>
        				</table>
					</td>
     			  </tr>
      
	  			
	  
	  
	  
	 			  <tr>
        				<td>
							<table width="100%">
           						<tr>
									<td valign="top"  width="20%">
										<table width="100%">

										<%
											if (request.isUserInRole("admin")) {
										%>
										<tr>
											<td bgcolor="#437A27" align="center" class="LEFT_BUTTON_all">
												<a href="register.jsp" target="_parent"
												class="LEFT_BUTTON_G">新增帳號</a>
											</td>
										</tr>
										<%}
											if (request.isUserInRole("manager") || request.isUserInRole("user")
													|| request.isUserInRole("admin")
													|| request.isUserInRole("professional")) {
										%>

										<tr>
											<td align="center" class="LEFT_BUTTON_top"><a
												href="editPw.jsp" target="_parent" class="LEFT_BUTTON_W">修改密碼</a>
											</td>
										</tr>
										<tr>
											<td bgcolor="#437A27" align="center"
												class="LEFT_BUTTON_middle"><a href="editData.jsp"
												target="_parent" class="LEFT_BUTTON_G">修改基本資料</a></td>
										</tr>
										<tr>
											<td align="center" class="LEFT_BUTTON_bottom"><a
												href="caseHistory.jsp" target="_parent" method="post"
												class="LEFT_BUTTON_W">填寫疾病資料</a></td>
										</tr>
										<tr>
											<td></td>
										</tr>
										<tr>
											<td bgcolor="#437A27" align="center" class="LEFT_BUTTON_top">
												<a href="questionnaire.jsp" target="_parent"
												class="LEFT_BUTTON_G">填寫體質問卷</a>
											</td>
										</tr>
										<tr>
											<td align="center" class="LEFT_BUTTON_bottom">
												<%
													if (request.isUserInRole("admin")
																|| request.isUserInRole("professional")) {
												%>
												<a href="questionhistory.jsp" target="_parent"
												class="LEFT_BUTTON_W">查詢體質歷史問卷</a> 
												<% } else {%> 
												<a href="history.jsp" target="_parent" class="LEFT_BUTTON_W">查詢體質歷史問卷</a>
												<% } %>
											</td>
										</tr>

										<tr>
											<td bgcolor="#437A27" align="center" class="LEFT_BUTTON_top">
												<a href="javascript:showSportlink()" class="LEFT_BUTTON_G">飲食養身規劃</a>
											</td>
										</tr>

										<tr>
											<td align="center" class="LEFT_BUTTON_bottom"><a
												href="sport.jsp" target="_parent" class="LEFT_BUTTON_W">運動養生規劃</a>
											</td>
										</tr>
										<tr>
											<%
												if (request.isUserInRole("admin")
															|| request.isUserInRole("professional")) {
											%>
											<td bgcolor="#437A27" align="center" class="LEFT_BUTTON_top">
												<a href="symptomsSearch/symptomsSearch.jsp" target="_new"
													class="LEFT_BUTTON_G">中醫症狀詞庫</a>
											</td>
											<% } %>
										</tr>
										<tr>
											<%
												if (request.isUserInRole("admin")
															|| request.isUserInRole("professional")) {
											%>
											<td align="center" class="LEFT_BUTTON_bottom">
												<a href="certificate.jsp" target="_new" class="LEFT_BUTTON_W">中醫辨證系統</a>
											</td>
											<% } %>
										</tr>
										<% } %>
									</table>

								</td>
									
									<td valign="top">
									<table width="100%">										
										<tr>	
												<td align="center" class="HEAD_STYLE" id="update" class="off">最新消息</td>
										</tr>
											<tr>
												<td>
													<table width="100%" border="1" bordercolor="#437A27" id="news" class="on_food"><td>
														<div style="overflow:auto; height:350px; width:100%" class="TEXT_STYLE">
															<table>
															<col style="width:5%">
															<col style="width:95%">
																	<tr>
																	<td class="news_date">2013/11/22</td>
																	<td class="news_context">版本7.0:增加參考食譜 。</td>
																	</tr>
																	<tr>
																	<td class="news_date">2013/10/22</td>
																	<td class="news_context">版本6.0:增加中醫症狀詞庫 。</td>
																	</tr>
																	<tr>
																	<td class="news_date">2013/10/09</td>
																	<td class="news_context">版本5.0:更新飲食養身規劃、體質問卷。</td>
																	</tr>
																	<tr>
																	<td class="news_date">2013/10/08</td>
																	<td class="news_context">版本4.2:增加飲食評量列印。</td>
																	</tr>
																	<tr>
																	<td class="news_date">2013/08/20</td>
																	<td class="news_context">版本4.1:飲食養生規劃新增營養品攝取。</td>
																	</tr>	
																	<tr>
																	<td class="news_date">2013/08/15</td>
																	<td class="news_context">版本4.0:新增營養品資料庫維護、飲食評量歷史紀錄。</td>
																	</tr>	
																	<tr>
																	<td class="news_date">2013/07/26</td>
																	<td class="news_context">版本3.2:修正飲食養生規劃細部功能。</td>
																	</tr>	
																	<tr>
																	<td class="news_date">2013/07/17</td>
																	<td class="news_context">版本3.1:修改飲食養生規劃、填寫疾病資料。</td>
																	</tr>	
																	<tr>
																	<td class="news_date">2013/06/03</td>
																	<td class="news_context">版本3.0:更新飲食養生規劃。</td>
																	</tr>															
																	<tr>
																	<td class="news_date">2012/11/15</td>
																	<td class="news_context">版本2.0:新增體質問卷題目，辨別體質部位。</td>
																	</tr>
																	
																	<tr>
																	<td class="news_date">2012/7/17</td>
																	<td class="news_context">版本1.3:首頁介面改版。</td>
																	</tr>
																	
																	<tr>
																	<td class="news_date">2012/7/06</td>
																
																	<td  class="news_context">版本1.2:介面修改，調整程式碼。</td>
																	</tr>
																	
																	<tr>
																	<td class="news_date">2012/7/02</td>
																
																	<td  class="news_context">版本1.1</td>
																	</tr>
																	
																	
																	<tr>
																	<td class="news_date">2012/6/29</td>
																	
																	<td  class="news_context"> 版本1.0</td>
																	</tr>
														  </table>
														</div></td>
													</table>
													
													<% if (request.isUserInRole("user")) { %>
													<div id="food" class="off">
															<iframe id="food_frame" width="100%" height="500px" src="notsuitfood.jsp" >
															</iframe>
													</div>
													<div id="suitfood" class="off">
															<iframe id="suitfood_frame" width="100%" height="500px" src="suitfood.jsp" >
															</iframe>
													</div>
													<% } %>
												</td>
             		</tr>
									</table>
									
									</td>

								</tr>
       					 </table>
         

         				</td>
      				</tr>
					<tr>
      					  <td bgcolor="#437A27"><div align="center" class="BOTTOM_STYLE">Copyright@ITRI and CCU_PLlab</div></td>
			  </tr>
			</table>
		</td>
	    
		<td width="5%">&nbsp;</td>
</table>
<p>&nbsp;</p>
</body>
</html>
